# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=kpipewire
pkgver=6.0.4
pkgrel=0
pkgdesc="Components relating to pipewire use in Plasma"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="BSD-3-Clause AND CC0-1.0 AND LGPL-2.1-only AND LGPL-3.0-only AND LicenseRef-KDE-Accepted-LGPL"
depends="pipewire"
depends_dev="
	ffmpeg-dev
	kcoreaddons-dev
	ki18n-dev
	kwayland-dev
	libdrm-dev
	libepoxy-dev
	libva-dev
	pipewire-dev
	plasma-wayland-protocols
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	qt6-qtwayland-dev
	wayland-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	pipewire-tools
	samurai
	"
checkdepends="xvfb-run"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/plasma/kpipewire.git"
source="https://download.kde.org/stable/plasma/$pkgver/kpipewire-$pkgver.tar.xz"
# Tests require running pipewire
options="!check"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	xvfb-run ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
c4c3accfb99e5bb588cb31ea6163de8f8c75bfd920e8309683b25ad1a92a9eed6bd8dd0ae229e11057eb0c368dd7a3374197a97ed1b5a1620ec6b6e5b7555f33  kpipewire-6.0.4.tar.xz
"
